import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3


Window {
    id:select_data
    width: 480
    height: 360
    color: "gray";
    LinkData
    {
        id:link_data
    }
    //结果提交的包围框和按钮
        Rectangle{
            id: resultHolder;
            color:"#a0a0a0";
            width: 200;
            height: 60;
            anchors.centerIn: parent;
            visible: false;
            z: 2;

            opacity: 0.8;

            border.width: 2;
            border.color: "#808080";

            Text{

                id:result;
                anchors.centerIn: parent;
                font.pixelSize: 35;
                color:"blue";
                font.bold: true;
            }
        }


        //定义的互斥分组
        ExclusiveGroup{

            id: data;
        }


        // 单选框框风格组件
        Component{

            id: radioStyle;
            RadioButtonStyle{

                indicator: Rectangle{
                    implicitHeight: 12;
                    implicitWidth: 16;

                    radius: 6;
                    border.color: control.hovered? "darkblue":"gray";
                    border.width: 1;

                    Rectangle{
                        anchors.fill: parent;
                        visible: control.checked;
                        color:"#0000a0";
                        radius: 5;
                        anchors.margins: 3;
                    }


                }



                label:Text{
                    color: control.activeFocus?"blue":"black";
                    text:control.text;
                    font.family: "楷体"; //设置字体
                    font.pixelSize: 20;//字体大小
                }


            }

        }



        //具体标签
        Text{
            id: notation;
            text:"选择所需数据源";
            font.family: "楷体"; //设置字体
            font.pixelSize: 25;//字体大小
            anchors.top: parent.top;
            anchors.topMargin: 60;
            anchors.left: parent.left;
            anchors.leftMargin: 40;

        }


        //具体单选框
        RadioButton{
            id:local;
            text:"本地数据";
            exclusiveGroup: data;
            anchors.top: notation.bottom;
            anchors.topMargin: 4;
            anchors.left: notation.left;
            anchors.leftMargin: 60;
            checked:  true;
            focus: true;
            activeFocusOnPress:  true;
            style:radioStyle;
            onClicked: resultHolder.visible = false;
        }
        RadioButton{

            id: online;
            text:"在线数据";
            exclusiveGroup: data;
            anchors.top: local.bottom;
            anchors.topMargin: 20;
            anchors.left: notation.left;
            anchors.leftMargin: 60;
            activeFocusOnPress: true;
            style:radioStyle;
            onClicked: resultHolder.visible = false;
        }

        //提交按钮
        Button{
            id: confirm;
            text:"启动";
            anchors.left: parent.left;//从左边开始
            anchors.leftMargin: 210;
            anchors.bottom: parent.bottom;
            anchors.bottomMargin: 60;
            onClicked: {
                result.text = data.current.text;
                resultHolder.visible = true;
                link_data.show();
            }

        }
}


